package com.wolfalpha.utron.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;

import com.wolfalpha.utron.R;
import com.wolfalpha.utron.activity.base.BaseNormal2Activity;
import com.wolfalpha.utron.adapter.ItemInformationAdapter;
import com.wolfalpha.utron.bean.ItemInformation;
import com.wolfalpha.utron.ui.UIHelper;
import com.wolfalpha.utron.view.AnimationListView;

import java.util.ArrayList;
import java.util.List;

/**
 * 资讯界面
 * <p/>
 * Created by luodon on 15/8/19.
 */
public class MyInformationActivity extends BaseNormal2Activity implements AdapterView.OnItemClickListener {

    private AnimationListView lvCollection;      //列表控件

    private ItemInformationAdapter itemInformationAdapter;//资讯适配器
    private List<ItemInformation> informations = new ArrayList<ItemInformation>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_information);

        loadData();
        intiView();
        initListeners();

    }

    /**
     * 加载列表的数据
     */
    private void loadData() {
        ItemInformation information = new ItemInformation();

        itemInformationAdapter = new ItemInformationAdapter(this, informations);
    }

    /**
     * 初始化界面
     */
    private void intiView() {
        setTvTitle("我的收藏");

        lvCollection = (AnimationListView) findViewById(R.id.lv_collection);

        lvCollection.setAdapter(itemInformationAdapter);
    }

    /**
     * 初始化监听
     */
    private void initListeners() {
        lvCollection.setOnItemClickListener(this);
    }

    @Override
    public void rightOperation() {
        UIHelper.ToastMessage(this, "您点击了删除按钮");
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        UIHelper.ToastMessage(this, "您点击了" + position);
    }
}
